import { defineStore } from "pinia";

const user = defineStore({
  id: "user",
  state: () => ({
    userInfo: {}, // 用户信息
    oldSession: "", //用户id
  }),
  getters: {},
  actions: {
    // 获取用户信息
    setInfo(data) {
      this.userInfo = data;
    },
    setSession(value) {
      this.oldSession = value;
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: "user-store",
      },
    ],
  },
});

export default user;
